﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;
using System.IO;
using System.ComponentModel;
using System.Web.Configuration;

namespace HospitalSystem
{
    public partial class index : System.Web.UI.Page
    {
        
  
        protected void Page_Load(object sender, EventArgs e)
        {
            String ShowValue = (string)Session["idlogin"];
            Label1.Text = ShowValue;

            infotolabel();

           

       }


      
        protected void infotolabel()

        {


            string constr = WebConfigurationManager.ConnectionStrings["strconnection"].ConnectionString;
            SqlConnection scon = new SqlConnection(constr);




            //string scon = WebConfigurationManager.ConnectionStrings["strconnection"].ConnectionString;
            SqlCommand CmdSql47 = new SqlCommand("SELECT a.[Fname] as Fname,a.[Lname] as Lname,a.[Tel] as Tel,a.[Email] as Email,a.[Address] as Address FROM [StaffTable] a join [LoginTable] b on a.Oid=b.Oid where b.username=@username", scon);
            scon.Open();

            //string comstr = "SELECT  a.[Oid],a.[Fname],a.[Lname],a.[Tel],a.[Email],a.[Address] FROM [StaffTable] a join [LoginTable] b on a.Oid=b.Oid where b.username='sjsniper'";
           // SqlConnection con = new SqlConnection(scon);
           // SqlCommand com = new SqlCommand(comstr, con);

            CmdSql47.Parameters.AddWithValue("@username", Label1.Text);
            //scon.Open();
           
            SqlDataReader reader = CmdSql47.ExecuteReader();
            // DataTable dt = new DataTable();
            //  dt.Load(reader);\
            // = reader;

            if (reader.Read())
            {
                //Label2.Text = reader["Fname"].ToString();
                //Label3.Text = reader["Lname"].ToString();
                //Label4.Text = reader["Tel"].ToString();
                //Label5.Text = reader["Email"].ToString();
                //Label6.Text = reader["Address"].ToString();

            }
            else
            {

            }
            scon.Close();
            reader.Close();


            Session["PSNumber01"] = Label1.Text;
        }
    }
}